<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Airwallex Apple Pay</title>
</head>
<body>
<h1>Airwallex Apple Pay</h1>
<button id="applePayBtn">Pay with Apple Pay</button>

<script>
    document.getElementById('applePayBtn').addEventListener('click', function () {
        fetch('/airwallex/intent/create', {
            method: 'POST',
            headers: {'Content-Type': 'application/x-www-form-urlencoded'},
            body: 'amount=10.00'
        }).then(res => res.json()).then(data => {
            console.log('PaymentIntent created:', data);
            alert("PaymentIntent ID: " + data.id);
        });
    });
</script>
</body>
</html>
